package com.example.qundui.learndemo.lvtest;

import android.app.Activity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import com.example.mylibrary.utils.commonutils.MyUtils;
import com.example.qundui.learndemo.R;
import com.yalantis.phoenix.PullToRefreshView;

/**
 * Created by qundui on 2017/5/2.
 */

public class LvTest extends Activity {
    private PullToRefreshView mPullToRefreshView;
    private ListView lv;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.testlv);
        lv= (ListView) findViewById(R.id.list_view);
        String[] mdatas={"a","b","c","d","e","f","g","h"};
        lv.setAdapter(new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,android.R.id.text1,mdatas));
        mPullToRefreshView = (PullToRefreshView) findViewById(R.id.pull_to_refresh);
        mPullToRefreshView.setOnRefreshListener(new PullToRefreshView.OnRefreshListener() {
            @Override
            public void onRefresh() {
                MyUtils.printLog("gsc"," 下拉刷新中.......");
                mPullToRefreshView.postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        mPullToRefreshView.setRefreshing(false);
                    }
                }, 2000);
            }
        });
    }
}
